package com.sun.abilities.thread.application;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Observable;
import java.util.Observer;

public class ObObject extends Observable{

	public ObObject(Observer ... obServers) {
		for (Observer observer : obServers) {
			this.addObserver(observer);
		}
	}
	
	private String msg;
	
	public void change(int num){
		this.setChanged();
		msg = "time = " + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
		this.notifyObservers(num);
		for (int i = 0; i < 500; i++) {
			System.out.println("obj i = "+i);
		}
		System.out.println("=======obj打印任务结束========");
	}

	public String getMsg() {
		return msg;
	}
}
